package com.xiaoyu.lanling.feature.im.provider

import com.xiaoyu.im.ChatToken
import com.xiaoyu.im.provider.ConversationListener
import com.xiaoyu.lanling.feature.chat.data.MessageListData
import com.xiaoyu.lanling.feature.conversation.date.ConversationListData

class ConversationListenerImpl : ConversationListener {

    override fun onConversationOpen(chatToken: ChatToken) {}

    override fun onConversationClose(chatToken: ChatToken) {
        MessageListData.instance.clearMessageList(chatToken.chatId, false)
    }

    override fun clearChatHistory(chatId: String) {
        MessageListData.instance.clearMessageList(chatId)
    }

    override fun clearAllChatHistory() {
        MessageListData.instance.clearAllMessageList()
    }

    override fun notifyItemListUpdate() {
        ConversationListData.instance.onHomeListUpdate()
    }
}